package com.java1227;

/**
 * 17、this 和super
 * this表示当前类的对象
 * super 表示父类的引用
 *
 */
class J{
    int x =2;

}
public class I extends J {
    int x =3;
    void m(){
        System.out.println(this.x);//当前的x
        System.out.println(super.x);//父类的x
    }


    String name;
    int age;

    public I(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public I() {

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "I{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
